package core.hxl;

import core.hxl.service.MessageProducer;
import core.hxl.stream.MessageObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

@Component
public class CommandLineRunnerImpl implements CommandLineRunner {

    @Autowired
    private MessageProducer messageProducer;

    @Override
    public void run(String... strings) throws Exception {
        int i=0;
        while (true){
            MessageObject messageObject=MessageObject.builder().mess("hello").time(i+"").build();
            messageProducer.sendMessage(messageObject);
            Thread.sleep(1000);
            i++;
        }
    }
}
